package cn.quang.search.toolkit.component;

/**
 * 安全检查
 * @author: 杨联泉
 * @since: 2018/04/16 17:22
 */
public final class SearchSecurtityUtil {
    /**
     * 检查查询条件构成中是否存在死循环
     * @param search
     * @return
     */
    public static boolean existsCirculateParent(final ISearch search){
        ISearch parent = search.getParentGroup();
        while (parent!=null){
            if(parent == search){
                return true;
            }

            parent = parent.getParentGroup();
        }

        return false;
    }

}
